package com.tran.tr.common.resp;

public class ApiResp<T> {
	public Integer code;
	public String message;
	public T body;

	public ApiResp() {
		super();
	}

	public ApiResp(Integer code, String message, T body) {
		super();
		this.code = code;
		this.message = message;
		this.body = body;
	}

	
	public static <T> ApiResp<T> success() {
		return new ApiResp<>(com.tran.tr.common.resp.ResponseCode.SUCCESS, ResponseMsg.SUCCESS, null);
	}

	public static <T> ApiResp<T> success(T body) {
		return new ApiResp<>(com.tran.tr.common.resp.ResponseCode.SUCCESS, ResponseMsg.SUCCESS, body);
	}

	public static <T> ApiResp<T> fail() {
		return new ApiResp<>(com.tran.tr.common.resp.ResponseCode.FAIL, ResponseMsg.FAIL, null);
	}

	public static <T> ApiResp<T> fail(String message) {
		return new ApiResp<>(com.tran.tr.common.resp.ResponseCode.FAIL, message, null);
	}

	public static <T> ApiResp<T> fail(Integer code, String message) {
		return new ApiResp<>(code, message, null);
	}
}
